//package com.exrobot.module.rbt.controller.admin.salefood;
//
//import org.springframework.web.bind.annotation.*;
//import jakarta.annotation.Resource;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.security.access.prepost.PreAuthorize;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.Operation;
//
//import jakarta.validation.constraints.*;
//import jakarta.validation.*;
//import jakarta.servlet.http.*;
//import java.util.*;
//import java.io.IOException;
//
//import com.exrobot.framework.common.pojo.PageParam;
//import com.exrobot.framework.common.pojo.PageResult;
//import com.exrobot.framework.common.pojo.CommonResult;
//import com.exrobot.framework.common.util.object.BeanUtils;
//import static com.exrobot.framework.common.pojo.CommonResult.success;
//
//import com.exrobot.framework.excel.core.util.ExcelUtils;
//
//import com.exrobot.framework.apilog.core.annotation.ApiAccessLog;
//import static com.exrobot.framework.apilog.core.enums.OperateTypeEnum.*;
//
//import com.exrobot.module.rbt.controller.admin.salefood.vo.*;
//import com.exrobot.module.rbt.dal.dataobject.salefood.SaleFoodDO;
//import com.exrobot.module.rbt.service.salefood.SaleFoodService;
//
//@Tag(name = "管理后台 - 可销售食品")
//@RestController
//@RequestMapping("/rbt/sale-food")
//@Validated
//public class SaleFoodController {
//
//    @Resource
//    private SaleFoodService saleFoodService;
//
//    @PostMapping("/create")
//    @Operation(summary = "创建可销售食品")
//    @PreAuthorize("@ss.hasPermission('rbt:sale-food:create')")
//    public CommonResult<Long> createSaleFood(@Valid @RequestBody SaleFoodSaveReqVO createReqVO) {
//        return success(saleFoodService.createSaleFood(createReqVO));
//    }
//
//    @PutMapping("/update")
//    @Operation(summary = "更新可销售食品")
//    @PreAuthorize("@ss.hasPermission('rbt:sale-food:update')")
//    public CommonResult<Boolean> updateSaleFood(@Valid @RequestBody SaleFoodSaveReqVO updateReqVO) {
//        saleFoodService.updateSaleFood(updateReqVO);
//        return success(true);
//    }
//
//    @DeleteMapping("/delete")
//    @Operation(summary = "删除可销售食品")
//    @Parameter(name = "id", description = "编号", required = true)
//    @PreAuthorize("@ss.hasPermission('rbt:sale-food:delete')")
//    public CommonResult<Boolean> deleteSaleFood(@RequestParam("id") Long id) {
//        saleFoodService.deleteSaleFood(id);
//        return success(true);
//    }
//
//    @DeleteMapping("/delete-list")
//    @Parameter(name = "ids", description = "编号", required = true)
//    @Operation(summary = "批量删除可销售食品")
//                @PreAuthorize("@ss.hasPermission('rbt:sale-food:delete')")
//    public CommonResult<Boolean> deleteSaleFoodList(@RequestParam("ids") List<Long> ids) {
//        saleFoodService.deleteSaleFoodListByIds(ids);
//        return success(true);
//    }
//
//    @GetMapping("/get")
//    @Operation(summary = "获得可销售食品")
//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
//    @PreAuthorize("@ss.hasPermission('rbt:sale-food:query')")
//    public CommonResult<SaleFoodRespVO> getSaleFood(@RequestParam("id") Long id) {
//        SaleFoodDO saleFood = saleFoodService.getSaleFood(id);
//        return success(BeanUtils.toBean(saleFood, SaleFoodRespVO.class));
//    }
//
//    @GetMapping("/page")
//    @Operation(summary = "获得可销售食品分页")
//    @PreAuthorize("@ss.hasPermission('rbt:sale-food:query')")
//    public CommonResult<PageResult<SaleFoodRespVO>> getSaleFoodPage(@Valid SaleFoodPageReqVO pageReqVO) {
//        PageResult<SaleFoodDO> pageResult = saleFoodService.getSaleFoodPage(pageReqVO);
//        return success(BeanUtils.toBean(pageResult, SaleFoodRespVO.class));
//    }
//
//    @GetMapping("/export-excel")
//    @Operation(summary = "导出可销售食品 Excel")
//    @PreAuthorize("@ss.hasPermission('rbt:sale-food:export')")
//    @ApiAccessLog(operateType = EXPORT)
//    public void exportSaleFoodExcel(@Valid SaleFoodPageReqVO pageReqVO,
//              HttpServletResponse response) throws IOException {
//        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
//        List<SaleFoodDO> list = saleFoodService.getSaleFoodPage(pageReqVO).getList();
//        // 导出 Excel
//        ExcelUtils.write(response, "可销售食品.xls", "数据", SaleFoodRespVO.class,
//                        BeanUtils.toBean(list, SaleFoodRespVO.class));
//    }
//
//}